package com.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;


import com.service.TbPictureService;
import com.utils.ResultJson;

@Controller
@RequestMapping("/tbPictureController.do")
public class TbPictureController {

	@Autowired
	private TbPictureService tbPictureService;
	Logger logger = Logger.getLogger(this.getClass());
	/**
	 * @描述:获取图片列表
	 * @创建时间:2018-12-29下午2:20:35
	 * @创建人：wls
	 * @参数： @param request
	 * @参数： @param types
	 * @参数： @return
	 * @参数： @throws Exception
	 */
	@RequestMapping(params = "selectPictures", method = { RequestMethod.POST })
	@ResponseBody
	public String selectPictures(HttpServletRequest request,@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
			@RequestParam(value = "pageSize", defaultValue = "10") int pageSize
			)
			throws Exception {
		ResultJson resultJson = null;
		resultJson = tbPictureService.selectPictures(pageNo,pageSize);
	
		return resultJson.getCommonJson();

	}

	
	
	/**
	 * @描述:根据url转码
	 * @创建时间:2019-3-13上午11:21:01
	 * @创建人：wls
	 * @参数： @param url
	 * @参数： @param request
	 * @参数： @return
	 * @参数： @throws Exception
	 */
	@RequestMapping(params = "transById", method = { RequestMethod.POST })
	@ResponseBody

	public  String transById(String url, HttpServletRequest request) throws Exception {
		ResultJson resultJson = tbPictureService.transById(url,request);


		return resultJson.getCommonJson();
	}
}
